Imports SERPS.ICdataLogic
Imports System.Data
Imports System.ComponentModel
Imports System.Data.SqlClient
'Imports SplitDataGrid.ScrollLessDataGrid
Public Class frmProductMasterView
    Inherits System.Windows.Forms.Form
    'Dim ScrollLessDataGrid As SplitDataGrid.ScrollLessDataGrid

    Dim icpAdd As frmProductMasterAdd
    Dim icpEdit As ICproductsEdit

    Dim icpSearch As frmProductSearch
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents Label5 As System.Windows.Forms.Label
    Friend WithEvents Label6 As System.Windows.Forms.Label
    Friend WithEvents Label7 As System.Windows.Forms.Label
    Friend WithEvents Label8 As System.Windows.Forms.Label
    Friend WithEvents Label9 As System.Windows.Forms.Label
    Friend WithEvents cmbCompany As DevComponents.DotNetBar.Controls.ComboBoxEx
    Friend WithEvents cmbSupplier As DevComponents.DotNetBar.Controls.ComboBoxEx
    Friend WithEvents cmbIndicator As DevComponents.DotNetBar.Controls.ComboBoxEx
    Friend WithEvents cmbCategory As DevComponents.DotNetBar.Controls.ComboBoxEx
    Friend WithEvents cmbManuf As DevComponents.DotNetBar.Controls.ComboBoxEx
    Friend WithEvents cmbBrand As DevComponents.DotNetBar.Controls.ComboBoxEx
    Friend WithEvents cmbDept As DevComponents.DotNetBar.Controls.ComboBoxEx
    Friend WithEvents cmbSubCat As DevComponents.DotNetBar.Controls.ComboBoxEx
    Friend WithEvents cmbSubSubCat As DevComponents.DotNetBar.Controls.ComboBoxEx
    Friend WithEvents cmdPrint As DevComponents.DotNetBar.ButtonX
    Friend WithEvents cmdExit As DevComponents.DotNetBar.ButtonX
    Friend WithEvents cmdRefresh As DevComponents.DotNetBar.ButtonX
    Friend WithEvents cmdDelete As DevComponents.DotNetBar.ButtonX
    Friend WithEvents cmdEdit As DevComponents.DotNetBar.ButtonX
    Friend WithEvents cmdSearch As DevComponents.DotNetBar.ButtonX
    Friend WithEvents GroupPanel1 As DevComponents.DotNetBar.Controls.GroupPanel
    Dim CompanyCode As Integer = CompanyID
#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'Me call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents gbType As System.Windows.Forms.GroupBox
    Friend WithEvents rbStock As System.Windows.Forms.RadioButton
    Friend WithEvents rbSample As System.Windows.Forms.RadioButton
    Friend WithEvents rbNonStock As System.Windows.Forms.RadioButton
    Friend WithEvents cbActive As System.Windows.Forms.CheckBox
    Friend WithEvents cbPromotion As System.Windows.Forms.CheckBox
    Friend WithEvents cbKit As System.Windows.Forms.CheckBox
    Friend WithEvents dgProduct As System.Windows.Forms.DataGrid
    Friend WithEvents ttHelp As System.Windows.Forms.ToolTip
    Friend WithEvents iClistOfProducts1 As IClistOfProducts
    Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
    Friend WithEvents rbPrice1 As System.Windows.Forms.RadioButton
    Friend WithEvents rbPrice2 As System.Windows.Forms.RadioButton
    Friend WithEvents rbNonActive As System.Windows.Forms.RadioButton
    Friend WithEvents rbActive As System.Windows.Forms.RadioButton
    Friend WithEvents rbBoth As System.Windows.Forms.RadioButton
    Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
    Friend WithEvents cmbGroup7 As System.Windows.Forms.ComboBox
    Friend WithEvents cmbGroup8 As System.Windows.Forms.ComboBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container()
        Me.rbStock = New System.Windows.Forms.RadioButton()
        Me.rbSample = New System.Windows.Forms.RadioButton()
        Me.rbNonStock = New System.Windows.Forms.RadioButton()
        Me.dgProduct = New System.Windows.Forms.DataGrid()
        Me.cbActive = New System.Windows.Forms.CheckBox()
        Me.cbPromotion = New System.Windows.Forms.CheckBox()
        Me.cbKit = New System.Windows.Forms.CheckBox()
        Me.gbType = New System.Windows.Forms.GroupBox()
        Me.ttHelp = New System.Windows.Forms.ToolTip(Me.components)
        Me.iClistOfProducts1 = New IClistOfProducts()
        Me.GroupBox1 = New System.Windows.Forms.GroupBox()
        Me.rbPrice1 = New System.Windows.Forms.RadioButton()

        Me.rbPrice2 = New System.Windows.Forms.RadioButton()
        Me.rbNonActive = New System.Windows.Forms.RadioButton()
        Me.rbActive = New System.Windows.Forms.RadioButton()
        Me.rbBoth = New System.Windows.Forms.RadioButton()
        Me.GroupBox2 = New System.Windows.Forms.GroupBox()
        Me.cmbGroup7 = New System.Windows.Forms.ComboBox()
        Me.cmbGroup8 = New System.Windows.Forms.ComboBox()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.Label2 = New System.Windows.Forms.Label()
        Me.Label3 = New System.Windows.Forms.Label()
        Me.Label4 = New System.Windows.Forms.Label()
        Me.Label5 = New System.Windows.Forms.Label()
        Me.Label6 = New System.Windows.Forms.Label()
        Me.Label7 = New System.Windows.Forms.Label()
        Me.Label8 = New System.Windows.Forms.Label()
        Me.Label9 = New System.Windows.Forms.Label()
        Me.cmbCompany = New DevComponents.DotNetBar.Controls.ComboBoxEx()
        Me.cmbSupplier = New DevComponents.DotNetBar.Controls.ComboBoxEx()
        Me.cmbIndicator = New DevComponents.DotNetBar.Controls.ComboBoxEx()
        Me.cmbCategory = New DevComponents.DotNetBar.Controls.ComboBoxEx()
        Me.cmbManuf = New DevComponents.DotNetBar.Controls.ComboBoxEx()
        Me.cmbBrand = New DevComponents.DotNetBar.Controls.ComboBoxEx()
        Me.cmbDept = New DevComponents.DotNetBar.Controls.ComboBoxEx()
        Me.cmbSubCat = New DevComponents.DotNetBar.Controls.ComboBoxEx()
        Me.cmbSubSubCat = New DevComponents.DotNetBar.Controls.ComboBoxEx()
        Me.cmdPrint = New DevComponents.DotNetBar.ButtonX()
        Me.cmdExit = New DevComponents.DotNetBar.ButtonX()
        Me.cmdRefresh = New DevComponents.DotNetBar.ButtonX()
        Me.cmdDelete = New DevComponents.DotNetBar.ButtonX()
        Me.cmdEdit = New DevComponents.DotNetBar.ButtonX()
        Me.cmdSearch = New DevComponents.DotNetBar.ButtonX()
        Me.GroupPanel1 = New DevComponents.DotNetBar.Controls.GroupPanel()
        CType(Me.dgProduct, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.gbType.SuspendLayout()
        Me.GroupBox1.SuspendLayout()
        Me.GroupBox2.SuspendLayout()
        Me.GroupPanel1.SuspendLayout()
        Me.SuspendLayout()
        '
        'rbStock
        '
        Me.rbStock.AutoSize = True
        Me.rbStock.Checked = True
        Me.rbStock.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.rbStock.Location = New System.Drawing.Point(11, 18)
        Me.rbStock.Name = "rbStock"
        Me.rbStock.Size = New System.Drawing.Size(59, 22)
        Me.rbStock.TabIndex = 9
        Me.rbStock.TabStop = True
        Me.rbStock.Text = "Stock"
        '
        'rbSample
        '
        Me.rbSample.AutoSize = True
        Me.rbSample.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.rbSample.Location = New System.Drawing.Point(11, 47)
        Me.rbSample.Name = "rbSample"
        Me.rbSample.Size = New System.Drawing.Size(78, 22)
        Me.rbSample.TabIndex = 11
        Me.rbSample.Text = "Samples"
        '
        'rbNonStock
        '
        Me.rbNonStock.AutoSize = True
        Me.rbNonStock.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.rbNonStock.Location = New System.Drawing.Point(11, 80)
        Me.rbNonStock.Name = "rbNonStock"
        Me.rbNonStock.Size = New System.Drawing.Size(90, 22)
        Me.rbNonStock.TabIndex = 12
        Me.rbNonStock.Text = "Non-Stock"
        '
        'dgProduct
        '
        Me.dgProduct.BackColor = System.Drawing.Color.AliceBlue
        Me.dgProduct.BackgroundColor = System.Drawing.Color.AliceBlue
        Me.dgProduct.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.dgProduct.CaptionVisible = False
        Me.dgProduct.DataMember = ""
        Me.dgProduct.HeaderBackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(192, Byte), Integer), CType(CType(128, Byte), Integer))
        Me.dgProduct.HeaderForeColor = System.Drawing.SystemColors.ControlText
        Me.dgProduct.Location = New System.Drawing.Point(13, 191)
        Me.dgProduct.Name = "dgProduct"
        Me.dgProduct.ReadOnly = True
        Me.dgProduct.Size = New System.Drawing.Size(1055, 441)
        Me.dgProduct.TabIndex = 13
        Me.ttHelp.SetToolTip(Me.dgProduct, "Click on Column Header to Sort.  Click in grid to select product")
        '
        'cbActive
        '
        Me.cbActive.ForeColor = System.Drawing.SystemColors.ControlLightLight
        Me.cbActive.Location = New System.Drawing.Point(874, 277)
        Me.cbActive.Name = "cbActive"
        Me.cbActive.Size = New System.Drawing.Size(91, 24)
        Me.cbActive.TabIndex = 18
        Me.cbActive.Text = "Discontinued"
        '
        'cbPromotion
        '
        Me.cbPromotion.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.cbPromotion.ForeColor = System.Drawing.SystemColors.ControlLightLight
        Me.cbPromotion.Location = New System.Drawing.Point(871, 307)
        Me.cbPromotion.Name = "cbPromotion"
        Me.cbPromotion.Size = New System.Drawing.Size(93, 24)
        Me.cbPromotion.TabIndex = 51
        Me.cbPromotion.Text = "On Promotion"
        '
        'cbKit
        '
        Me.cbKit.ForeColor = System.Drawing.SystemColors.ControlLightLight
        Me.cbKit.Location = New System.Drawing.Point(980, 307)
        Me.cbKit.Name = "cbKit"
        Me.cbKit.Size = New System.Drawing.Size(46, 24)
        Me.cbKit.TabIndex = 52
        Me.cbKit.Text = "Kits"
        '
        'gbType
        '
        Me.gbType.BackColor = System.Drawing.Color.Transparent
        Me.gbType.Controls.Add(Me.rbNonStock)
        Me.gbType.Controls.Add(Me.rbSample)
        Me.gbType.Controls.Add(Me.rbStock)
        Me.gbType.Location = New System.Drawing.Point(871, 1)
        Me.gbType.Name = "gbType"
        Me.gbType.Size = New System.Drawing.Size(119, 116)
        Me.gbType.TabIndex = 54
        Me.gbType.TabStop = False
        '
        'GroupBox1
        '
        Me.GroupBox1.BackColor = System.Drawing.Color.Transparent
        Me.GroupBox1.Controls.Add(Me.rbPrice1)
        Me.GroupBox1.Controls.Add(Me.rbPrice2)
        Me.GroupBox1.Location = New System.Drawing.Point(751, 2)
        Me.GroupBox1.Name = "GroupBox1"
        Me.GroupBox1.Size = New System.Drawing.Size(107, 78)
        Me.GroupBox1.TabIndex = 167
        Me.GroupBox1.TabStop = False
        '
        'rbPrice1
        '
        Me.rbPrice1.AutoSize = True
        Me.rbPrice1.Checked = True
        Me.rbPrice1.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.rbPrice1.Location = New System.Drawing.Point(9, 19)
        Me.rbPrice1.Name = "rbPrice1"
        Me.rbPrice1.Size = New System.Drawing.Size(78, 22)
        Me.rbPrice1.TabIndex = 56
        Me.rbPrice1.TabStop = True
        Me.rbPrice1.Text = "1st Price"
        '
        'rbPrice2
        '
        Me.rbPrice2.AutoSize = True
        Me.rbPrice2.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.rbPrice2.Location = New System.Drawing.Point(9, 47)
        Me.rbPrice2.Name = "rbPrice2"
        Me.rbPrice2.Size = New System.Drawing.Size(86, 22)
        Me.rbPrice2.TabIndex = 57
        Me.rbPrice2.Text = "2nd  Price"
        '
        'rbNonActive
        '
        Me.rbNonActive.BackColor = System.Drawing.Color.Transparent
        Me.rbNonActive.ForeColor = System.Drawing.SystemColors.ControlLightLight
        Me.rbNonActive.Location = New System.Drawing.Point(157, 14)
        Me.rbNonActive.Name = "rbNonActive"
        Me.rbNonActive.Size = New System.Drawing.Size(86, 19)
        Me.rbNonActive.TabIndex = 205
        Me.rbNonActive.Text = "Reservered"
        Me.rbNonActive.UseVisualStyleBackColor = False
        '
        'rbActive
        '
        Me.rbActive.ForeColor = System.Drawing.SystemColors.ControlLightLight
        Me.rbActive.Location = New System.Drawing.Point(956, 322)
        Me.rbActive.Name = "rbActive"
        Me.rbActive.Size = New System.Drawing.Size(70, 17)
        Me.rbActive.TabIndex = 204
        Me.rbActive.Text = "Active"
        '
        'rbBoth
        '
        Me.rbBoth.Checked = True
        Me.rbBoth.ForeColor = System.Drawing.SystemColors.ControlLightLight
        Me.rbBoth.Location = New System.Drawing.Point(887, 322)
        Me.rbBoth.Name = "rbBoth"
        Me.rbBoth.Size = New System.Drawing.Size(58, 19)
        Me.rbBoth.TabIndex = 203
        Me.rbBoth.TabStop = True
        Me.rbBoth.Text = "Both"
        '
        'GroupBox2
        '
        Me.GroupBox2.BackColor = System.Drawing.Color.Transparent
        Me.GroupBox2.Controls.Add(Me.rbNonActive)
        Me.GroupBox2.Location = New System.Drawing.Point(871, 284)
        Me.GroupBox2.Name = "GroupBox2"
        Me.GroupBox2.Size = New System.Drawing.Size(243, 33)
        Me.GroupBox2.TabIndex = 206
        Me.GroupBox2.TabStop = False
        '
        'cmbGroup7
        '
        Me.cmbGroup7.BackColor = System.Drawing.Color.AliceBlue
        Me.cmbGroup7.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cmbGroup7.Location = New System.Drawing.Point(164, 256)
        Me.cmbGroup7.Name = "cmbGroup7"
        Me.cmbGroup7.Size = New System.Drawing.Size(166, 26)
        Me.cmbGroup7.TabIndex = 208
        '
        'cmbGroup8
        '
        Me.cmbGroup8.BackColor = System.Drawing.Color.AliceBlue
        Me.cmbGroup8.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cmbGroup8.Location = New System.Drawing.Point(385, 256)
        Me.cmbGroup8.Name = "cmbGroup8"
        Me.cmbGroup8.Size = New System.Drawing.Size(175, 26)
        Me.cmbGroup8.TabIndex = 223
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.BackColor = System.Drawing.Color.Transparent
        Me.Label1.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.Label1.Location = New System.Drawing.Point(9, 2)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(66, 18)
        Me.Label1.TabIndex = 224
        Me.Label1.Text = "Company"
        '
        'Label2
        '
        Me.Label2.AutoSize = True
        Me.Label2.BackColor = System.Drawing.Color.Transparent
        Me.Label2.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.Label2.Location = New System.Drawing.Point(269, 2)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(60, 18)
        Me.Label2.TabIndex = 224
        Me.Label2.Text = "Supplier"
        '
        'Label3
        '
        Me.Label3.AutoSize = True
        Me.Label3.BackColor = System.Drawing.Color.Transparent
        Me.Label3.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.Label3.Location = New System.Drawing.Point(9, 56)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(83, 18)
        Me.Label3.TabIndex = 224
        Me.Label3.Text = "Department"
        '
        'Label4
        '
        Me.Label4.AutoSize = True
        Me.Label4.BackColor = System.Drawing.Color.Transparent
        Me.Label4.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.Label4.Location = New System.Drawing.Point(264, 56)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(44, 18)
        Me.Label4.TabIndex = 224
        Me.Label4.Text = "Brand"
        '
        'Label5
        '
        Me.Label5.AutoSize = True
        Me.Label5.BackColor = System.Drawing.Color.Transparent
        Me.Label5.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.Label5.Location = New System.Drawing.Point(523, 56)
        Me.Label5.Name = "Label5"
        Me.Label5.Size = New System.Drawing.Size(92, 18)
        Me.Label5.TabIndex = 224
        Me.Label5.Text = "Manufacturer"
        '
        'Label6
        '
        Me.Label6.AutoSize = True
        Me.Label6.BackColor = System.Drawing.Color.Transparent
        Me.Label6.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.Label6.Location = New System.Drawing.Point(9, 111)
        Me.Label6.Name = "Label6"
        Me.Label6.Size = New System.Drawing.Size(63, 18)
        Me.Label6.TabIndex = 224
        Me.Label6.Text = "Category"
        '
        'Label7
        '
        Me.Label7.AutoSize = True
        Me.Label7.BackColor = System.Drawing.Color.Transparent
        Me.Label7.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label7.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.Label7.Location = New System.Drawing.Point(265, 112)
        Me.Label7.Name = "Label7"
        Me.Label7.Size = New System.Drawing.Size(89, 18)
        Me.Label7.TabIndex = 224
        Me.Label7.Text = "Sub Category"
        '
        'Label8
        '
        Me.Label8.AutoSize = True
        Me.Label8.BackColor = System.Drawing.Color.Transparent
        Me.Label8.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.Label8.Location = New System.Drawing.Point(523, 111)
        Me.Label8.Name = "Label8"
        Me.Label8.Size = New System.Drawing.Size(115, 18)
        Me.Label8.TabIndex = 224
        Me.Label8.Text = "Sub Sub Category"
        '
        'Label9
        '
        Me.Label9.AutoSize = True
        Me.Label9.BackColor = System.Drawing.Color.Transparent
        Me.Label9.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.Label9.Location = New System.Drawing.Point(521, 2)
        Me.Label9.Name = "Label9"
        Me.Label9.Size = New System.Drawing.Size(114, 18)
        Me.Label9.TabIndex = 224
        Me.Label9.Text = "Product Indicator"
        '
        'cmbCompany
        '
        Me.cmbCompany.DisplayMember = "Text"
        Me.cmbCompany.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed
        Me.cmbCompany.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cmbCompany.ItemHeight = 19
        Me.cmbCompany.Location = New System.Drawing.Point(10, 23)
        Me.cmbCompany.Name = "cmbCompany"
        Me.cmbCompany.Size = New System.Drawing.Size(242, 25)
        Me.cmbCompany.TabIndex = 225
        '
        'cmbSupplier
        '
        Me.cmbSupplier.DisplayMember = "Text"
        Me.cmbSupplier.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed
        Me.cmbSupplier.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cmbSupplier.ItemHeight = 19
        Me.cmbSupplier.Location = New System.Drawing.Point(268, 23)
        Me.cmbSupplier.Name = "cmbSupplier"
        Me.cmbSupplier.Size = New System.Drawing.Size(242, 25)
        Me.cmbSupplier.TabIndex = 225
        '
        'cmbIndicator
        '
        Me.cmbIndicator.DisplayMember = "Text"
        Me.cmbIndicator.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed
        Me.cmbIndicator.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cmbIndicator.ItemHeight = 19
        Me.cmbIndicator.Location = New System.Drawing.Point(525, 23)
        Me.cmbIndicator.Name = "cmbIndicator"
        Me.cmbIndicator.Size = New System.Drawing.Size(208, 25)
        Me.cmbIndicator.TabIndex = 225
        '
        'cmbCategory
        '
        Me.cmbCategory.DisplayMember = "Text"
        Me.cmbCategory.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed
        Me.cmbCategory.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cmbCategory.ItemHeight = 19
        Me.cmbCategory.Location = New System.Drawing.Point(10, 133)
        Me.cmbCategory.Name = "cmbCategory"
        Me.cmbCategory.Size = New System.Drawing.Size(242, 25)
        Me.cmbCategory.TabIndex = 225
        '
        'cmbManuf
        '
        Me.cmbManuf.DisplayMember = "Text"
        Me.cmbManuf.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed
        Me.cmbManuf.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cmbManuf.ItemHeight = 19
        Me.cmbManuf.Location = New System.Drawing.Point(525, 77)
        Me.cmbManuf.Name = "cmbManuf"
        Me.cmbManuf.Size = New System.Drawing.Size(208, 25)
        Me.cmbManuf.TabIndex = 225
        '
        'cmbBrand
        '
        Me.cmbBrand.DisplayMember = "Text"
        Me.cmbBrand.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed
        Me.cmbBrand.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cmbBrand.ItemHeight = 19
        Me.cmbBrand.Location = New System.Drawing.Point(268, 77)
        Me.cmbBrand.Name = "cmbBrand"
        Me.cmbBrand.Size = New System.Drawing.Size(242, 25)
        Me.cmbBrand.TabIndex = 225
        '
        'cmbDept
        '
        Me.cmbDept.DisplayMember = "Text"
        Me.cmbDept.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed
        Me.cmbDept.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cmbDept.ItemHeight = 19
        Me.cmbDept.Location = New System.Drawing.Point(10, 76)
        Me.cmbDept.Name = "cmbDept"
        Me.cmbDept.Size = New System.Drawing.Size(242, 25)
        Me.cmbDept.TabIndex = 225
        '
        'cmbSubCat
        '
        Me.cmbSubCat.DisplayMember = "Text"
        Me.cmbSubCat.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed
        Me.cmbSubCat.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cmbSubCat.ItemHeight = 19
        Me.cmbSubCat.Location = New System.Drawing.Point(268, 133)
        Me.cmbSubCat.Name = "cmbSubCat"
        Me.cmbSubCat.Size = New System.Drawing.Size(242, 25)
        Me.cmbSubCat.TabIndex = 225
        '
        'cmbSubSubCat
        '
        Me.cmbSubSubCat.DisplayMember = "Text"
        Me.cmbSubSubCat.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed
        Me.cmbSubSubCat.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cmbSubSubCat.ItemHeight = 19
        Me.cmbSubSubCat.Location = New System.Drawing.Point(525, 133)
        Me.cmbSubSubCat.Name = "cmbSubSubCat"
        Me.cmbSubSubCat.Size = New System.Drawing.Size(208, 25)
        Me.cmbSubSubCat.TabIndex = 225
        '
        'cmdPrint
        '
        Me.cmdPrint.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton
        Me.cmdPrint.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.cmdPrint.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(64, Byte), Integer))
        Me.cmdPrint.Location = New System.Drawing.Point(901, 647)
        Me.cmdPrint.Name = "cmdPrint"
        Me.cmdPrint.Size = New System.Drawing.Size(82, 27)
        Me.cmdPrint.TabIndex = 296
        Me.cmdPrint.Text = "Print"
        '
        'cmdExit
        '
        Me.cmdExit.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton
        Me.cmdExit.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.cmdExit.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(64, Byte), Integer))
        Me.cmdExit.Location = New System.Drawing.Point(988, 647)
        Me.cmdExit.Name = "cmdExit"
        Me.cmdExit.Size = New System.Drawing.Size(80, 27)
        Me.cmdExit.TabIndex = 295
        Me.cmdExit.Text = "Exit"
        '
        'cmdRefresh
        '
        Me.cmdRefresh.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton
        Me.cmdRefresh.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.cmdRefresh.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(64, Byte), Integer))
        Me.cmdRefresh.Location = New System.Drawing.Point(813, 648)
        Me.cmdRefresh.Name = "cmdRefresh"
        Me.cmdRefresh.Size = New System.Drawing.Size(82, 27)
        Me.cmdRefresh.TabIndex = 296
        Me.cmdRefresh.Text = "Refresh"
        '
        'cmdDelete
        '
        Me.cmdDelete.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton
        Me.cmdDelete.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.cmdDelete.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(64, Byte), Integer))
        Me.cmdDelete.Location = New System.Drawing.Point(725, 649)
        Me.cmdDelete.Name = "cmdDelete"
        Me.cmdDelete.Size = New System.Drawing.Size(82, 27)
        Me.cmdDelete.TabIndex = 296
        Me.cmdDelete.Text = "Delete"
        '
        'cmdEdit
        '
        Me.cmdEdit.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton
        Me.cmdEdit.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.cmdEdit.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(64, Byte), Integer))
        Me.cmdEdit.Location = New System.Drawing.Point(637, 650)
        Me.cmdEdit.Name = "cmdEdit"
        Me.cmdEdit.Size = New System.Drawing.Size(82, 27)
        Me.cmdEdit.TabIndex = 296
        Me.cmdEdit.Text = "Edit"
        '
        'cmdSearch
        '
        Me.cmdSearch.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton
        Me.cmdSearch.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.cmdSearch.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(64, Byte), Integer))
        Me.cmdSearch.Location = New System.Drawing.Point(549, 650)
        Me.cmdSearch.Name = "cmdSearch"
        Me.cmdSearch.Size = New System.Drawing.Size(82, 27)
        Me.cmdSearch.TabIndex = 296
        Me.cmdSearch.Text = "Search"
        '
        'GroupPanel1
        '
        Me.GroupPanel1.CanvasColor = System.Drawing.SystemColors.Control
        Me.GroupPanel1.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007
        Me.GroupPanel1.Controls.Add(Me.Label9)
        Me.GroupPanel1.Controls.Add(Me.Label1)
        Me.GroupPanel1.Controls.Add(Me.Label3)
        Me.GroupPanel1.Controls.Add(Me.Label4)
        Me.GroupPanel1.Controls.Add(Me.Label5)
        Me.GroupPanel1.Controls.Add(Me.Label6)
        Me.GroupPanel1.Controls.Add(Me.cmbManuf)
        Me.GroupPanel1.Controls.Add(Me.cmbSubSubCat)
        Me.GroupPanel1.Controls.Add(Me.Label7)
        Me.GroupPanel1.Controls.Add(Me.cmbBrand)
        Me.GroupPanel1.Controls.Add(Me.cmbCategory)
        Me.GroupPanel1.Controls.Add(Me.cmbSubCat)
        Me.GroupPanel1.Controls.Add(Me.cmbDept)
        Me.GroupPanel1.Controls.Add(Me.Label8)
        Me.GroupPanel1.Controls.Add(Me.Label2)
        Me.GroupPanel1.Controls.Add(Me.GroupBox1)
        Me.GroupPanel1.Controls.Add(Me.gbType)
        Me.GroupPanel1.Controls.Add(Me.GroupBox2)
        Me.GroupPanel1.Controls.Add(Me.cmbIndicator)
        Me.GroupPanel1.Controls.Add(Me.cmbCompany)
        Me.GroupPanel1.Controls.Add(Me.cmbSupplier)
        Me.GroupPanel1.Dock = System.Windows.Forms.DockStyle.Fill
        Me.GroupPanel1.Location = New System.Drawing.Point(0, 0)
        Me.GroupPanel1.Name = "GroupPanel1"
        Me.GroupPanel1.Size = New System.Drawing.Size(1080, 688)
        '
        '
        '
        Me.GroupPanel1.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2
        Me.GroupPanel1.Style.BackColorGradientAngle = 90
        Me.GroupPanel1.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground
        Me.GroupPanel1.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid
        Me.GroupPanel1.Style.BorderBottomWidth = 1
        Me.GroupPanel1.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder
        Me.GroupPanel1.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid
        Me.GroupPanel1.Style.BorderLeftWidth = 1
        Me.GroupPanel1.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid
        Me.GroupPanel1.Style.BorderRightWidth = 1
        Me.GroupPanel1.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid
        Me.GroupPanel1.Style.BorderTopWidth = 1
        Me.GroupPanel1.Style.CornerDiameter = 4
        Me.GroupPanel1.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded
        Me.GroupPanel1.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center
        Me.GroupPanel1.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText
        Me.GroupPanel1.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near
        Me.GroupPanel1.TabIndex = 297
        Me.GroupPanel1.Text = "Product Master - View"
        '
        'frmProductMasterView
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(7, 19)
        Me.BackColor = System.Drawing.SystemColors.ActiveCaption
        Me.ClientSize = New System.Drawing.Size(1080, 688)
        Me.ControlBox = False
        Me.Controls.Add(Me.cmdSearch)
        Me.Controls.Add(Me.cmdEdit)
        Me.Controls.Add(Me.cmdRefresh)
        Me.Controls.Add(Me.cmdDelete)
        Me.Controls.Add(Me.cmdPrint)
        Me.Controls.Add(Me.cmdExit)
        Me.Controls.Add(Me.dgProduct)
        Me.Controls.Add(Me.cmbGroup8)
        Me.Controls.Add(Me.cmbGroup7)
        Me.Controls.Add(Me.rbBoth)
        Me.Controls.Add(Me.cbPromotion)
        Me.Controls.Add(Me.cbActive)
        Me.Controls.Add(Me.rbActive)
        Me.Controls.Add(Me.cbKit)
        Me.Controls.Add(Me.GroupPanel1)
        Me.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.ForeColor = System.Drawing.Color.White
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
        Me.Location = New System.Drawing.Point(70, 70)
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "frmProductMasterView"
        Me.ShowInTaskbar = False
        Me.StartPosition = System.Windows.Forms.FormStartPosition.Manual
        CType(Me.dgProduct, System.ComponentModel.ISupportInitialize).EndInit()
        Me.gbType.ResumeLayout(False)
        Me.gbType.PerformLayout()
        Me.GroupBox1.ResumeLayout(False)
        Me.GroupBox1.PerformLayout()
        Me.GroupBox2.ResumeLayout(False)
        Me.GroupPanel1.ResumeLayout(False)
        Me.GroupPanel1.PerformLayout()
        Me.ResumeLayout(False)

    End Sub

#End Region
    Private Sub ICproducts_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Dim SmGrid As DataGrid = New SplitDataGrid.ScrollLessDataGrid
        'SmGrid.BringToFront()

        Dim ICdata As New ICdataLogic
        Dim ds As DataSet
        ds = ICdata.GetAllCompany()
        cmbCompany.DataSource = ds.Tables(0)
        cmbCompany.ValueMember = "CompanyID"
        cmbCompany.DisplayMember = "CompanyName"
        cmbCompany.SelectedValue = CompanyID
        LoadGroupCombos(CompanyID)

        Dim ds5 As DataSet
        Dim dRow As DataRow
        ds5 = ICdata.GetCompanySuppliers(CompanyID)
        dRow = ds5.Tables(0).NewRow()
        dRow("SupID") = 0
        dRow("SupName") = "Select A Supplier"
        ds5.Tables(0).Rows.Add(dRow)
        cmbSupplier.DataSource = ds5.Tables(0)
        cmbSupplier.ValueMember = "SupID"
        cmbSupplier.DisplayMember = "SupName"
        cmbSupplier.SelectedValue = 0
        ICdata = Nothing
        '
        Me.Location = New Point(3, 3)

    End Sub
    Private Sub LoadGroupCombos(ByVal CompanyCode As Integer)
        Dim ICdata As New ICdataLogic
        Dim ds As DataSet
        If CompanyCode = 1 Then
            CompanyCode = 0
        End If
        ds = ICdata.GetProductGroups(CompanyCode, 1)
        cmbDept.DataSource = ds.Tables(0)
        cmbDept.ValueMember = "GroupID"
        cmbDept.DisplayMember = "GroupName"
        cmbDept.SelectedValue = 0
        '
        ds = ICdata.GetProductGroups(CompanyCode, 2)
        cmbBrand.DataSource = ds.Tables(0)
        cmbBrand.ValueMember = "GroupID"
        cmbBrand.DisplayMember = "GroupName"
        cmbBrand.SelectedValue = 0
        '
        ds = ICdata.GetProductGroups(CompanyCode, 3)
        cmbManuf.DataSource = ds.Tables(0)
        cmbManuf.ValueMember = "GroupID"
        cmbManuf.DisplayMember = "GroupName"
        cmbManuf.SelectedValue = 0
        '
        ds = ICdata.GetProductGroups(CompanyCode, 4)
        cmbCategory.DataSource = ds.Tables(0)
        cmbCategory.ValueMember = "GroupID"
        cmbCategory.DisplayMember = "GroupName"
        cmbCategory.SelectedValue = 0
        '
        ds = ICdata.GetProductGroups(CompanyCode, 5)
        cmbSubCat.DataSource = ds.Tables(0)
        cmbSubCat.ValueMember = "GroupID"
        cmbSubCat.DisplayMember = "GroupName"
        cmbSubCat.SelectedValue = 0
        '
        ds = ICdata.GetProductGroups(CompanyCode, 6)
        cmbSubSubCat.DataSource = ds.Tables(0)
        cmbSubSubCat.ValueMember = "GroupID"
        cmbSubSubCat.DisplayMember = "GroupName"
        cmbSubSubCat.SelectedValue = 0
        '
        ds = ICdata.GetProductGroups(CompanyCode, 7)
        cmbGroup7.DataSource = ds.Tables(0)
        cmbGroup7.ValueMember = "GroupID"
        cmbGroup7.DisplayMember = "GroupName"
        cmbGroup7.SelectedValue = 0
        '
        ds = ICdata.GetProductGroups(CompanyCode, 8)
        cmbGroup8.DataSource = ds.Tables(0)
        cmbGroup8.ValueMember = "GroupID"
        cmbGroup8.DisplayMember = "GroupName"
        cmbGroup8.SelectedValue = 0
        '
        Dim ds2 As DataSet
        ds2 = ICdata.GetProductIndicator()
        cmbIndicator.DataSource = ds2.Tables(0)
        cmbIndicator.ValueMember = "IndicatorID"
        cmbIndicator.DisplayMember = "IndicatorName"
        '
        ICdata = Nothing
    End Sub
    Private Sub cmdRefresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdRefresh.Click, cmdEdit.Click, cmdSearch.Click
        Me.Cursor = Cursors.WaitCursor
        Dim WhereClause As String = ""
        'WhereClause = " where "  'CompanyCode=" & cmbCompany.SelectedValue
        Dim CompanyCode As Integer = cmbCompany.SelectedValue

        Dim PromotFlag As Integer
        Dim KitFlag As Integer
        Dim ActiveFlag As Integer


        Dim ThisYear As Integer = Now.Year
        Dim FinYear As Integer = ThisYear
        If Now.Month > 4 Then
            FinYear = FinYear + 1
        End If
        ActiveFlag = FinYear
        'If cbActive.Checked = True Then

        '    If CompanyCode = 0 Then
        '        WhereClause += " and Discontinued<=" & ActiveFlag & " and Discontinued>0 "
        '    Else
        '        WhereClause += " and Discontinued2<=" & ActiveFlag & " and Discontinued2>0 "
        '    End If
        'Else
        '    ActiveFlag = 0
        '    WhereClause += " and Discontinued=" & ActiveFlag
        'End If
        Dim ProdType As Integer
        ProdType = 1
        If rbStock.Checked = True Then
            ProdType = 1
        Else
            If rbSample.Checked = True Then
                ProdType = 2
            Else
                If rbNonStock.Checked = True Then
                    ProdType = 3
                End If
            End If
        End If
        'WhereClause += " and OnPromotionFlag=" & PromotFlag
        'WhereClause += " and KitFlag=" & KitFlag
        WhereClause += " and ProductType=" & ProdType

        'Dim ProdStatus As Integer
        'ProdStatus = 2
        'If rbActive.Checked = True Then
        '    ProdStatus = 1
        'Else
        '    If rbNonActive.Checked = True Then
        '        ProdStatus = 0
        '    End If
        'End If
        'If ProdStatus <> 2 Then
        '    WhereClause += " and ActiveFlag=" & ProdStatus
        'End If

        If cmbDept.SelectedValue <> 0 Then
            WhereClause += " and Group1Code=" & cmbDept.SelectedValue
        End If
        If cmbBrand.SelectedValue <> 0 Then
            WhereClause += " and Group2Code=" & cmbBrand.SelectedValue
        End If
        If cmbManuf.SelectedValue <> 0 Then
            WhereClause += " and Group3Code=" & cmbManuf.SelectedValue
        End If
        If cmbCategory.SelectedValue <> 0 Then
            WhereClause += " and Group4Code=" & cmbCategory.SelectedValue
        End If
        If cmbSubCat.SelectedValue <> 0 Then
            WhereClause += " and Group5Code=" & cmbSubCat.SelectedValue
        End If
        If cmbSubSubCat.SelectedValue <> 0 Then
            WhereClause += " and Group6Code=" & cmbSubSubCat.SelectedValue
        End If

        'Jackson commented on 4 Aug 2014---------------------------------------------------------------

        'If cmbGroup7.SelectedValue <> 0 Then
        '    WhereClause += " and Group7Code=" & cmbGroup7.SelectedValue
        'End If
        'If cmbGroup8.SelectedValue <> 0 Then
        '    WhereClause += " and Group8Code=" & cmbGroup8.SelectedValue
        'End If
        'Jackson commented on 4 Aug 2014---------------------------------------------------------------

        If cmbIndicator.SelectedValue <> 0 Then
            If cmbIndicator.SelectedValue <> 5 Then
                WhereClause += " and ProductIndicator=" & cmbIndicator.SelectedValue
            End If
        End If
        If cmbIndicator.SelectedValue = 5 Then
            WhereClause += " and Discontinued<=" & ActiveFlag & " and Discontinued>0 "
        End If

        Dim ICdata As New ICdataLogic

        Dim ds As DataSet

        'MessageBox.Show("companycode : " & CompanyCode & " Supplier : " & cmbSupplier.SelectedValue & "  where : " & WhereClause)

        ds = ICdata.GetProducts(CompanyCode, cmbSupplier.SelectedValue, WhereClause)
        '
        Dim GrandTotal As Double
        Dim dRow As DataRow
        For Each dRow In ds.Tables(0).Rows
            If Not IsDBNull(dRow("ACTQTY")) Then
                'If CDbl(dRow("ACTQTY")) > 0 Then
                GrandTotal = GrandTotal + CDbl(dRow("TOTALCOST"))
                dRow("TotalCost") = CDbl(dRow("TotalCost")).ToString("###,##0.000")
                'Else
                '    dRow("AverageCost") = "0.000"
                '    dRow("TotalCost") = "0.000"
                'End If
            End If
        Next
        dRow = ds.Tables(0).NewRow()
        dRow("ShortDescriptionE") = "GRAND TOTAL:"
        dRow("TotalCost") = GrandTotal.ToString("###,##0.000")
        ds.Tables(0).Rows.Add(dRow)
        '
        dgProduct.DataSource = ds.Tables(0)
        'SmallGrid.DataSource = ds.Tables(0)
        With dgProduct
            ' .BackgroundColor = GridBackgroundColor
            .TableStyles.Clear()
            .CaptionBackColor = System.Drawing.Color.SlateBlue
            .CaptionForeColor = System.Drawing.Color.LemonChiffon
            .AllowSorting = True
            .AlternatingBackColor = System.Drawing.Color.AliceBlue
            .ParentRowsBackColor = System.Drawing.Color.Lavender
            .ParentRowsForeColor = System.Drawing.Color.SlateBlue
            .HeaderBackColor = System.Drawing.Color.LemonChiffon
            .AllowNavigation = False
            .ParentRowsVisible = False
            .RowHeadersVisible = False
        End With
        Dim cm As CurrencyManager = BindingContext(dgProduct.DataSource, dgProduct.DataMember)
        Dim dv As DataView = cm.List
        dv.AllowNew = False
        'smformat(ds.Tables(0).Rows.Count)
        dgformat(ds.Tables(0).Rows.Count)
        ICdata = Nothing
        Me.Cursor = Cursors.Default


    End Sub
    Private Sub dgformat(ByVal RowCount As Integer)
        Dim grdTableStyle As New DataGridTableStyle
        With grdTableStyle
            .AlternatingBackColor = Color.AliceBlue
            .HeaderFont = New Font("calibri", 9.0!, FontStyle.Bold)
            .MappingName = "PRODUCT"
            .PreferredColumnWidth = 160
            .HeaderBackColor = Color.LightSlateGray
            .HeaderForeColor = Color.LightCyan
            .PreferredRowHeight = 15
            .RowHeadersVisible = False
            .RowHeaderWidth = 0
        End With
        Dim cs1 As DataGridColumnStyle
        cs1 = New DataGridTextBoxColumn
        cs1.Width = 0
        cs1.MappingName = "PRODUCTID"
        cs1.HeaderText = "CODE"
        cs1.NullText = ""
        cs1.ReadOnly = True
        grdTableStyle.GridColumnStyles.Add(cs1)
        '
        cs1 = New DataGridTextBoxColumn
        cs1.Width = 150
        cs1.MappingName = "PRODUCTCODE"
        cs1.HeaderText = "PRODUCTCODE "
        cs1.NullText = ""
        cs1.ReadOnly = True
        grdTableStyle.GridColumnStyles.Add(cs1)
        '
        cs1 = New DataGridTextBoxColumn
        cs1.Width = 150
        cs1.MappingName = "MANUFPRODUCTCODE"
        cs1.HeaderText = "MANUF.PRODUCTCODE "
        cs1.NullText = ""
        cs1.ReadOnly = True
        grdTableStyle.GridColumnStyles.Add(cs1)
        '
        cs1 = New DataGridTextBoxColumn
        cs1.Width = 250
        cs1.MappingName = "SHORTDESCRIPTIONE"
        cs1.HeaderText = "DESCRIPTION "
        cs1.NullText = ""
        cs1.ReadOnly = True
        grdTableStyle.GridColumnStyles.Add(cs1)
        '
        cs1 = New DataGridTextBoxColumn
        cs1.Width = 90
        If rbPrice1.Checked = True Then
            cs1.MappingName = "FIRSTPRICE"
        Else
            cs1.MappingName = "SECONDPRICE"
        End If
        cs1.HeaderText = "PRICE-RSP "
        cs1.NullText = ""
        cs1.ReadOnly = True
        cs1.Alignment = HorizontalAlignment.Right
        grdTableStyle.GridColumnStyles.Add(cs1)
        '
        If UserGroupID <> 10 And UserGroupID <> 9 And UserGroupID <> 7 Then
            cs1 = New DataGridTextBoxColumn
            cs1.Width = 90
            cs1.MappingName = "AVERAGECOST"
            cs1.HeaderText = "AVERAGE COST "
            cs1.NullText = ""
            cs1.ReadOnly = True
            cs1.Alignment = HorizontalAlignment.Right
            grdTableStyle.GridColumnStyles.Add(cs1)
        End If
        '
        cs1 = New DataGridTextBoxColumn
        cs1.Width = 80
        cs1.MappingName = "ACTQTY"
        cs1.HeaderText = "ON HAND QTY "
        cs1.NullText = ""
        cs1.ReadOnly = True
        cs1.Alignment = HorizontalAlignment.Right
        grdTableStyle.GridColumnStyles.Add(cs1)
        '
        If UserGroupID <> 10 And UserGroupID <> 9 And UserGroupID <> 7 Then
            cs1 = New DataGridTextBoxColumn
            cs1.Width = 100
            cs1.MappingName = "TOTALCOST"
            cs1.HeaderText = "TOTAL COST "
            cs1.NullText = ""
            cs1.ReadOnly = True
            cs1.Alignment = HorizontalAlignment.Right
            grdTableStyle.GridColumnStyles.Add(cs1)
        End If
        '
        cs1 = New DataGridTextBoxColumn
        cs1.Width = 70
        cs1.MappingName = "AVLQTY"
        cs1.HeaderText = "AVAL.QTY "
        cs1.NullText = ""
        cs1.ReadOnly = True
        cs1.Alignment = HorizontalAlignment.Right
        grdTableStyle.GridColumnStyles.Add(cs1)
        '
        cs1 = New DataGridTextBoxColumn
        If RowCount > 12 Then
            cs1.Width = 75
        Else
            cs1.Width = 70
        End If
        cs1.MappingName = "CMDQTY"
        cs1.HeaderText = "CMTD.QTY "
        cs1.NullText = ""
        cs1.ReadOnly = True
        cs1.Alignment = HorizontalAlignment.Right
        grdTableStyle.GridColumnStyles.Add(cs1)
        '
        dgProduct.TableStyles.Add(grdTableStyle)
    End Sub
    Private Sub smformat(ByVal RowCount As Integer)
        Dim grdTableStyle As New DataGridTableStyle
        With grdTableStyle
            .AlternatingBackColor = Color.AliceBlue
            .HeaderFont = New Font("Tahoma", 8.0!, FontStyle.Bold)
            .MappingName = "PRODUCT"
            .PreferredColumnWidth = 160
            .HeaderBackColor = Color.LightSlateGray
            .HeaderForeColor = Color.LightCyan
            .PreferredRowHeight = 15
            .RowHeadersVisible = False
            .RowHeaderWidth = 0
        End With
        Dim cs1 As DataGridColumnStyle
        cs1 = New DataGridTextBoxColumn
        cs1.Width = 0
        cs1.MappingName = "PRODUCTID"
        cs1.HeaderText = "CODE"
        cs1.NullText = ""
        cs1.ReadOnly = True
        grdTableStyle.GridColumnStyles.Add(cs1)
        '
        cs1 = New DataGridTextBoxColumn
        cs1.Width = 100
        cs1.MappingName = "PRODUCTCODE"
        cs1.HeaderText = "CODE"
        cs1.NullText = ""
        cs1.ReadOnly = True
        grdTableStyle.GridColumnStyles.Add(cs1)
        '
        cs1 = New DataGridTextBoxColumn
        cs1.Width = 98
        cs1.MappingName = "MANUFPRODUCTCODE"
        cs1.HeaderText = "MANUF.CODE"
        cs1.NullText = ""
        cs1.ReadOnly = True
        grdTableStyle.GridColumnStyles.Add(cs1)
        '
        'If SmallGrid.TableStyles.Count = 0 Then
        '    SmallGrid.TableStyles.Add(grdTableStyle)
        'End If
    End Sub
    Private Sub cmbCompany_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs)
        CompanyCode = cmbCompany.SelectedValue
        LoadGroupCombos(CompanyCode)
    End Sub

    Private Sub cmdExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdExit.Click
        Me.Close()
    End Sub

    Private Sub cmdEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdEdit.Click
        Dim ApData As New APdataLogic
        If ApData.IsValidUserOption(UserID, 0, 59) = True Or UserGroupID = 1 Then
            Dim CurrentRow As Integer = dgProduct.CurrentCell.RowNumber
            dgProductSelectedID = dgProduct.Item(CurrentRow, 0)
            icpEdit = New ICproductsEdit
            icpEdit.ShowDialog()
        Else
            MsgBox("Access Denied !", MsgBoxStyle.Critical, "Inventory Manager")
        End If
        ApData = Nothing

    End Sub

    Private Sub dgProduct_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles dgProduct.MouseUp
        Dim pt As New Point(e.X, e.Y)
        Dim hti As DataGrid.HitTestInfo = dgProduct.HitTest(pt)
        If hti.Type = DataGrid.HitTestType.Cell Then
            dgProduct.CurrentCell = New DataGridCell(hti.Row, hti.Column)
            dgProduct.Select(hti.Row)
            Dim CurrentRow As Integer = dgProduct.CurrentCell.RowNumber
        End If
    End Sub

    Private Sub cmdDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdDelete.Click
        Dim ApData As New APdataLogic
        If ApData.IsValidUserOption(UserID, 0, 72) = True Or UserGroupID = 1 Then

            Dim CurrentRow As Integer = dgProduct.CurrentCell.RowNumber
            dgProduct.Select(CurrentRow)
            Dim ProdDelID As String = dgProduct.Item(CurrentRow, 0)
            Dim ProdDelCode As String = dgProduct.Item(CurrentRow, 1)
            Dim ProdDelDesc As String = dgProduct.Item(CurrentRow, 3)
            If MsgBox("Are you sure to delete Product:" & ProdDelCode & vbLf & ProdDelDesc, MsgBoxStyle.YesNo, "Inventory Manager") = MsgBoxResult.Yes Then
                Dim ICdata As New ICdataLogic
                Try
                    Dim rValue As String = ""
                    rValue = ICdata.DeleteProduct(ProdDelID)
                    If rValue = "OK" Then
                        MsgBox("Product:" & ProdDelCode & " deleted.", MsgBoxStyle.Information, "Inventory Manager")
                        cmdRefresh.PerformClick()
                    Else
                        MsgBox(rValue, MsgBoxStyle.Information, "Inventory Manager")
                    End If
                Catch ex As Exception
                    MsgBox("Unable to satisfy your request." & vbLf & "Try again later.", MsgBoxStyle.Critical, "Inventory Manager")
                Finally
                    ICdata = Nothing
                End Try
            End If

        Else
            MsgBox("Access Denied !", MsgBoxStyle.Critical, "Inventory Manager")
        End If

    End Sub
    Dim icpop As Object

    Private Sub cmdSearchh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSearch.Click
        icpSearch = New frmProductSearch
        icpSearch.ShowDialog()
        icpSearch.BringToFront()
    End Sub

    Private Sub cmdPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdPrint.Click, cmdDelete.Click

        Dim ApData As New APdataLogic
        If ApData.IsValidUserOption(UserID, 0, 73) = True Or UserGroupID = 1 Then
            Me.Cursor = Cursors.WaitCursor

            Dim ds As DataSet = New DataSet("SerpsRpt")
            Dim table As DataTable = New DataTable("SerpsRpt")
            table.Columns.Add("Str1")
            table.Columns.Add("Str2")
            table.Columns.Add("Str3")
            table.Columns.Add("Dec1")
            table.Columns.Add("Dec2")
            table.Columns.Add("Int1")
            table.Columns.Add("Dec3")
            table.Columns.Add("Int2")
            table.Columns.Add("Int3")


            Dim mrow, drow As Integer
            Dim cm As CurrencyManager = BindingContext(dgProduct.DataSource, dgProduct.DataMember)
            Dim dv As DataView = cm.List
            dv.RowStateFilter = DataViewRowState.CurrentRows
            mrow = dv.Count
            Dim ProdCode As String
            Dim ProdDesc As String
            Dim ProdQty As String

            Dim n As Integer
            For n = 0 To mrow - 1
                Dim nrow As DataRow = table.NewRow()
                nrow("Str1") = dgProduct.Item(n, 1)
                nrow("Str2") = dgProduct.Item(n, 2)
                nrow("Str3") = dgProduct.Item(n, 3)
                nrow("Dec1") = dgProduct.Item(n, 4)
                If UserGroupID <> 10 And UserGroupID <> 9 And UserGroupID <> 7 Then
                    nrow("Dec2") = dgProduct.Item(n, 5)
                    nrow("Int1") = dgProduct.Item(n, 6)
                    nrow("Dec3") = dgProduct.Item(n, 7)
                    nrow("Int2") = dgProduct.Item(n, 8)
                    nrow("Int3") = dgProduct.Item(n, 9)
                Else
                    nrow("Dec2") = 0.0
                    nrow("Dec3") = 0.0
                    nrow("Int1") = dgProduct.Item(n, 5)
                    nrow("Int2") = dgProduct.Item(n, 6)
                    nrow("Int3") = dgProduct.Item(n, 7)
                End If
                table.Rows.Add(nrow)
            Next
            ds.Tables.Add(table)

            iClistOfProducts1.Load()
            iClistOfProducts1.SetDataSource(ds)

            iClistOfProducts1.SetParameterValue("CompanyName", CompanyTitle)
            iClistOfProducts1.SetParameterValue("ReportTitle", "List of Products")
            iClistOfProducts1.SetParameterValue("CriteriaTitle", cmbDept.Text + "/" + cmbBrand.Text + "/" + cmbManuf.Text + "/" + cmbCategory.Text + "/" + cmbSubCat.Text)
            If PrntPrv Is Nothing Then
                PrntPrv = New PrintPreviewForm
                PrntPrv.CrRptView.ReportSource = iClistOfProducts1
                PrntPrv.ShowDialog()
            End If
            iClistOfProducts1.Close()
            Me.Cursor = Cursors.Default

        Else
            MsgBox("Access Denied !", MsgBoxStyle.Critical, "Inventory Manager")
        End If

    End Sub

    'Private Sub cmbDept_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbDept.SelectedIndexChanged
    '    If IsNumeric(cmbDept.SelectedValue) Then
    '        Dim ICdata As New ICdataLogic
    '        Dim ds As DataSet
    '        If cmbDept.SelectedValue > 0 Then
    '            ds = ICdata.GetBrandRelatedGroups(CompanyCode, 2, cmbDept.SelectedValue)
    '            cmbBrand.DataSource = ds.Tables(0)
    '            cmbBrand.ValueMember = "GroupID"
    '            cmbBrand.DisplayMember = "GroupName"
    '            cmbBrand.SelectedValue = 0
    '            '
    '            ds = ICdata.GetBrandRelatedGroups(CompanyCode, 3, cmbDept.SelectedValue)
    '            cmbGroup3.DataSource = ds.Tables(0)
    '            cmbGroup3.ValueMember = "GroupID"
    '            cmbGroup3.DisplayMember = "GroupName"
    '            cmbGroup3.SelectedValue = 0
    '            '
    '            ds = ICdata.GetBrandRelatedGroups(CompanyCode, 4, cmbDept.SelectedValue)
    '            cmbGroup4.DataSource = ds.Tables(0)
    '            cmbGroup4.ValueMember = "GroupID"
    '            cmbGroup4.DisplayMember = "GroupName"
    '            cmbGroup4.SelectedValue = 0
    '            '
    '            ds = ICdata.GetBrandRelatedGroups(CompanyCode, 5, cmbDept.SelectedValue)
    '            cmbGroup5.DataSource = ds.Tables(0)
    '            cmbGroup5.ValueMember = "GroupID"
    '            cmbGroup5.DisplayMember = "GroupName"
    '            cmbGroup5.SelectedValue = 0
    '            '
    '            ds = ICdata.GetBrandRelatedGroups(CompanyCode, 6, cmbDept.SelectedValue)
    '            cmbGroup6.DataSource = ds.Tables(0)
    '            cmbGroup6.ValueMember = "GroupID"
    '            cmbGroup6.DisplayMember = "GroupName"
    '            cmbGroup6.SelectedValue = 0
    '            '
    '            ds = ICdata.GetBrandRelatedGroups(CompanyCode, 7, cmbDept.SelectedValue)
    '            cmbGroup7.DataSource = ds.Tables(0)
    '            cmbGroup7.ValueMember = "GroupID"
    '            cmbGroup7.DisplayMember = "GroupName"
    '            cmbGroup7.SelectedValue = 0
    '            '
    '            ds = ICdata.GetBrandRelatedGroups(CompanyCode, 8, cmbDept.SelectedValue)
    '            cmbGroup8.DataSource = ds.Tables(0)
    '            cmbGroup8.ValueMember = "GroupID"
    '            cmbGroup8.DisplayMember = "GroupName"
    '            cmbGroup8.SelectedValue = 0
    '            '
    '        Else
    '            ds = ICdata.GetProductGroups(CompanyCode, 2)
    '            cmbBrand.DataSource = ds.Tables(0)
    '            cmbBrand.ValueMember = "GroupID"
    '            cmbBrand.DisplayMember = "GroupName"
    '            cmbBrand.SelectedValue = 0
    '            '
    '            ds = ICdata.GetProductGroups(CompanyCode, 3)
    '            cmbGroup3.DataSource = ds.Tables(0)
    '            cmbGroup3.ValueMember = "GroupID"
    '            cmbGroup3.DisplayMember = "GroupName"
    '            cmbGroup3.SelectedValue = 0
    '            '
    '            ds = ICdata.GetProductGroups(CompanyCode, 4)
    '            cmbGroup4.DataSource = ds.Tables(0)
    '            cmbGroup4.ValueMember = "GroupID"
    '            cmbGroup4.DisplayMember = "GroupName"
    '            cmbGroup4.SelectedValue = 0
    '            '
    '            ds = ICdata.GetProductGroups(CompanyCode, 5)
    '            cmbGroup5.DataSource = ds.Tables(0)
    '            cmbGroup5.ValueMember = "GroupID"
    '            cmbGroup5.DisplayMember = "GroupName"
    '            cmbGroup5.SelectedValue = 0
    '            '
    '            ds = ICdata.GetProductGroups(CompanyCode, 6)
    '            cmbGroup6.DataSource = ds.Tables(0)
    '            cmbGroup6.ValueMember = "GroupID"
    '            cmbGroup6.DisplayMember = "GroupName"
    '            cmbGroup6.SelectedValue = 0
    '            '
    '            ds = ICdata.GetProductGroups(CompanyCode, 7)
    '            cmbGroup7.DataSource = ds.Tables(0)
    '            cmbGroup7.ValueMember = "GroupID"
    '            cmbGroup7.DisplayMember = "GroupName"
    '            cmbGroup7.SelectedValue = 0
    '            '
    '            ds = ICdata.GetProductGroups(CompanyCode, 8)
    '            cmbGroup8.DataSource = ds.Tables(0)
    '            cmbGroup8.ValueMember = "GroupID"
    '            cmbGroup8.DisplayMember = "GroupName"
    '            cmbGroup8.SelectedValue = 0
    '        End If
    '        ICdata = Nothing
    '    End If
    'End Sub

End Class
